LEXER=../../.objs/release/TriplePLexer.o
PARSER=../../.objs/release/TriplePParser.o
LIB=../../lib/release/libgrmr.a
MODE ?=release
FLAG=

ifeq ($(MODE),debug)
FLAG = -g
LEXER=../../.objs/debug/MINILexer.o
PARSER=../../.objs/debug/MINIParser.o
LIB=../../lib/debug/libgrmr.a
endif

$(LIB): $(LEXER) $(PARSER)
	ar rcs $(LIB) $(LEXER) $(PARSER)

$(LEXER): TriplePLexer.c TriplePLexer.h
	g++ -o $(LEXER) $(FLAG) -c TriplePLexer.c -I.

$(PARSER): TriplePParser.c TriplePParser.h
	g++ -o $(PARSER) $(FLAG) -c TriplePParser.c -I ../../include/

TriplePLexer.c TriplePParser.c : TripleP.g
	java -jar ../../3rd/antlr-3.2.jar TripleP.g 
clean: 
	rm -f *.c *.h *.tokens $(LIB)
